header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;

  .darkmode {
    margin-left: 12px;
    width: 22px;
    height: 22px;
    border-radius: 100px;
    background: url($moon) no-repeat $toggle-bg;
    background-size: 14px 14px;
    background-position: center;
    cursor: pointer;
  }

  .logo {
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .logo-image {
    background: url($logo) no-repeat;
    height: 20px;
    width: 124.5px;
    display: block;
    box-sizing: border-box;
    border: none;
    outline: none;
  }

  .search {
    label {
      color: $text1;
      font-size: 1em;
      margin-right: 0.3em;
    }

    input {
      background: $bg-main;
      color: $text1;
      border: 1px solid $input-border;
      box-sizing: border-box;
      font-size: 1em;
      padding: 0.5em 0.75em;

      &:focus {
        outline: 1px solid $main;
      }
    }

    button {
      padding: 0.5em 1.25em;
      cursor: pointer;
      background-color: $main;
      font-size: 1em;
      border-radius: 2px;
      color: #fff;
      font-family: "Rubik";
      border: none;
      letter-spacing: 0.01em;
    }
  }
}

.error {
  border: 1px solid $border;
  box-sizing: border-box;
  border-radius: 2px;
  display: flex;
  background-color: $bg-main;
  padding: 2em;
  align-items: center;

  .error-state{
    content:url($error-image);
    mix-blend-mode: $blend-mode;
  }

  .message {
    display: flex;
    flex-direction: column;

    h2 {
      font-size: 1.5em;
      letter-spacing: 0.01em;
      color: $text1;
    }

    h3 {
      line-height: 1.5em;
      font-size: 1em;
      color: $text3;
      &::after{
        content: $error;
      }
    }

  }
}

.main {
  aside {
    .about {
      background: $bg-main;
      border: 1px solid $border;
      box-sizing: border-box;
      border-radius: 2px 2px 0px 0px;
      padding: 1em;
      display: flex;
      flex-direction: row;
      align-items: center;

      .dp {
        img {
          height: 44px;
          width: auto;
          border-radius: 100%;
        }

        margin-right: 0.75em;
      }

      .name {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;

        h1 {
          color: $text1;
          font-size: 1em;
          margin-bottom: 0.375em;
        }

        a {
          color: $main;
          text-decoration: none;
          font-size: 0.875em;
        }
      }
    }

    .stats {
      background: $bg-main;
      border-right: 1px solid $border;
      border-bottom: 1px solid $border;
      border-left: 1px solid $border;
      box-sizing: border-box;
      border-radius: 2px 2px 0px 0px;
      padding: 1em;
      display: flex;
      flex-direction: column;

      .item {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        margin-bottom: 1em;

        &:last-child {
          margin-bottom: 0;
        }

        h3 {
          font-size: 0.875em;
          letter-spacing: 0.01em;
          color: $aside-head;
        }

        p {
          font-size: 1em;
          letter-spacing: 0.01em;
          color: $aside-text;
        }
      }
    }

    .lang {
      background: $bg-main;
      border-right: 1px solid $border;
      border-bottom: 1px solid $border;
      border-left: 1px solid $border;
      box-sizing: border-box;
      border-radius: 2px 2px 0px 0px;
      padding: 0.5em;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;

      span {
        margin: 0.5em;
        text-align: center;
        font-size: 0.75em;
        letter-spacing: 0.01em;
        color: $main;
        padding: 0.5em;
        background-color: rgba($main, 0.05);
        border-radius: 1px;
        margin-right: 0.5em;
      }
    }

    .dates {
      background: $bg-main;
      border-right: 1px solid $border;
      border-bottom: 1px solid $border;
      border-left: 1px solid $border;
      box-sizing: border-box;
      border-radius: 2px 2px 0px 0px;
      padding: 1em;

      h4 {
        font-size: 0.75em;
        letter-spacing: 0.01em;
        color: $aside-head;
      }

      p {
        font-size: 0.875em;
        letter-spacing: 0.01em;
        color: $aside-text;
        margin-top: 0.5em;
      }

      .joined {
        margin-bottom: 1em;
      }

      .location {
        margin-bottom: 0.875em;

        p {
          color: $main;
        }
      }

      span {
        font-size: 0.875em;
        text-align: right;
        letter-spacing: 0.01em;
        color: $footer;
      }
    }
  }

  section {
    background: $bg-main;
    border: 1px solid $border;
    box-sizing: border-box;
    border-radius: 2px;

    h2 {
      font-size: 18px;
      letter-spacing: 0.01em;
      text-transform: uppercase;
      color: $text1;
      padding: 1.5em 1.5em 0 1.5em;
    }

    hr {
      margin: 0.75em 0;
      height: 0;
      border: 1px solid $border;
    }

    .activities {
      padding: 0 1.5em 1.5em 1.5em;

      .act {
        display: flex;
        padding: 0.75em 0;
        border-bottom: 1px solid $border;

        &:last-child {
          border-bottom: none;
        }

        .entry {
          font-size: 1em;
          letter-spacing: 0.01em;
          line-height: 1.5em;
          color: $text2;
          margin-right: 0.5em;
        }

        .time {
          font-size: 1em;
          letter-spacing: 0.01em;
          color: $text3;
          margin-left: 0.5em;
          line-height: 1.5em;
          text-align: right;
          flex-shrink: 0;
        }
      }
    }
  }
}

@media screen and (max-width: 767px) {

  padding: 1em;

  .main {
    display: flex;
    flex-direction: column-reverse;
  }

  header {
    flex-direction: column;
    justify-content: center;
    margin-top: 1.5em;

    .search {
      label {
        margin-right: 0;
      }

      form {
        margin-top: 1em;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: row;

        label {
          display: none;
        }

        button {
          margin-left: 0.5em;
        }
      }
    }
  }

  section {
    margin-bottom: 1em;
    .act {
      flex-direction: column;

      .time {
        margin: 0.25em 0 0 0;
        margin-left: 0 !important;
        text-align: left!important;
      }
    }
    .activities{
      padding: 0 1em 1em 1em!important;
    }
  }

  .error {
    flex-direction: column;
    justify-content: center;

    h2 {
      margin-bottom: 0.5em;
    }
  }
}

@media screen and (min-width: 768px) {

  padding: 2em;
  max-width: 980px;
  margin: 0 auto;

  .main {
    display: flex;
    flex-direction: row;

    aside {
      margin-right: 2%;
      width: 28%;
      min-width: 240px;
    }

    section {
      width: 70%;

      .act {
        flex-direction: row;
        justify-content: space-between;
      }
    }
  }

  .error {
    flex-direction: row;

    .octocat {
      margin-right: 1.5em;
    }

    h2 {
      margin-bottom: 0.825em;
    }
  }
}
